import request from "@/utils/request";
var baseUrl = '/admin/roleManage/'

export function roleList(data) {
  return request({
    url: baseUrl+'list',
    method: 'post',
    data
  })
}

export function roleAll() {
  return request({
    url: baseUrl+'all',
    method: 'get'
  })
}

export function resourceList() {
  return request({
    url: baseUrl+'resource/list',
    method: 'get'
  })
}

export function roleDelete(id) {
  return request({
    url: baseUrl+'delete',
    method: 'post',
    params: {id}
  })
}

export function resourceByRoleId(id) {
  return request({
    url: baseUrl+'resource/byRoleId',
    method: 'get',
    params: {id}
  })
}

export function updateRole(data) {
  return request({
    url: baseUrl+'update',
    method: 'post',
    data
  })
}

export function addRole(data) {
  return request({
    url: baseUrl+'add',
    method: 'post',
    data
  })
}

export function getRole(id) {
  return request({
    url: baseUrl+'getRole',
    method: 'get',
    params: {id}
  })
}
